package reflect;

import java.io.File;
import java.lang.reflect.Field;

public class ReflectDemo8 {
    public static void main(String[] args) throws Exception {
        Teacher teacher=new Teacher();
        teacher.name="张三";
        System.out.println(teacher);
        Class cls=Class.forName("reflect.Teacher");
        Object obj =cls.newInstance();
        Field field=cls.getField("name");
        field.set(obj,"发短信韩国");
        System.out.println(obj);
        System.out.println(field.get(obj));
    }
}
